package com.youqingkuang.ipmsg.listener;

import java.util.Observable;
import java.util.Observer;
import com.youqingkuang.ipmsg.event.MessageEvent;

public abstract class MessageListener implements Observer {

    public void update(Observable source, Object event) {
        if (event instanceof MessageEvent) {
            messageArrival((MessageEvent)event);
        } else {
            throw new IllegalArgumentException("unknown event");
        }
    }

    public abstract void messageArrival(MessageEvent event);

}
